//
//  UIView+Position.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/8/2.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit
import Foundation

extension UIView {

    //frame.origin.x
    public var left: CGFloat {
        get {
            return self.frame.origin.x
        }
        set {
            var frame = self.frame
            frame.origin.x = newValue
            self.frame = frame
        }
    }
    
    //frame.origin.y
    public var top: CGFloat {
        get {
            return self.frame.origin.y
        }
        set {
            var frame = self.frame
            frame.origin.y = newValue
            self.frame = frame
        }
    }
    
    //frame.origin
    public var origin: CGPoint {
        get {
            return self.frame.origin
        }
        set {
            var frame = self.frame
            frame.origin = origin
            self.frame = frame
        }
    }
    
    //frame.size
    public var size: CGSize {
        get {
            return self.frame.size
        }
        set {
            var frame = self.frame
            frame.size = size
            self.frame = frame
        }
    }
    
    //maxX
    public var maxX: CGFloat {
        get {
            return self.frame.origin.x + self.frame.size.width
        }
    }
    
    //maxY
    public var maxY: CGFloat {
        get {
            return self.frame.origin.y + self.frame.size.height
        }
    }


}
